using System;
using System.IO;
using System.Net;
using System.Text;
public class UploadUtil1
{
	public static string smethod_0(string url, string file_path)
	{
		HttpWebRequest httpWebRequest = WebRequest.Create(url) as HttpWebRequest;
		CookieContainer cookieContainer = new CookieContainer();
		httpWebRequest.CookieContainer = cookieContainer;
		httpWebRequest.AllowAutoRedirect = true;
		httpWebRequest.Method = "POST";
		string str = DateTime.Now.Ticks.ToString("X");
		httpWebRequest.ContentType = "multipart/form-data;charset=utf-8;boundary=" + str;
		byte[] bytes = Encoding.UTF8.GetBytes("\r\n--" + str + "\r\n");
		byte[] bytes2 = Encoding.UTF8.GetBytes("\r\n--" + str + "--\r\n");
		int num = file_path.LastIndexOf("\\");
		string arg = file_path.Substring(num + 1);
		StringBuilder stringBuilder = new StringBuilder(string.Format("Content-Disposition:form-data;name=\"upfile\";filename=\"{0}\"\r\nContent-Type:application/octet-stream\r\n\r\n", arg));
		byte[] bytes3 = Encoding.UTF8.GetBytes(stringBuilder.ToString());
		FileStream fileStream = new FileStream(file_path, FileMode.Open, FileAccess.Read);
		byte[] array = new byte[fileStream.Length];
		fileStream.Read(array, 0, array.Length);
		fileStream.Close();
		Stream requestStream = httpWebRequest.GetRequestStream();
		requestStream.Write(bytes, 0, bytes.Length);
		requestStream.Write(bytes3, 0, bytes3.Length);
		requestStream.Write(array, 0, array.Length);
		requestStream.Write(bytes2, 0, bytes2.Length);
		requestStream.Close();
		HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse;
		StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream(), Encoding.UTF8);
		return streamReader.ReadToEnd();
	}
}
